//
//  DDRetweeted_statusModel.swift
//  swift微博
//
//  Created by whitcast on 16/7/15.
//  Copyright © 2016年 whitcast. All rights reserved.
//

import UIKit

class DDRetweeted_statusModel: NSObject {
    //创建时间
    var created_at: String?
    //微博id
    var id: Int64 = 0
    //微博内容
    var text: String?
    //微博来源
    var source: String?
    //用户
    var user: DDUserModel?
//    //转发数
//    var reposts_count: Int = 0
//    //评论数
//    var comments_count: Int = 0
//    //赞的数量
//    var attitudes_count : Int = 0
    //模型
    var ueserModel: DDUserModel?
    //配图数量
    var pic_urls: [DDPicViewModel]?
    
    //字典转模型
    init(dict:[String: AnyObject]){
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        //判断是否是用户信息
        if key == "user" {
            user = DDUserModel.init(dict: (value as? [String: AnyObject])!)
        }else if(key == "pic_urls"){
            
            var marr = [DDPicViewModel]()
            
            let arr = value as? [[String: AnyObject]] ?? []
            
            for dic in arr{
                let model = DDPicViewModel.init(dict: dic)
                
                marr.append(model)
            }
            
           pic_urls = marr
            
        }else{
            super.setValue(value, forKey: key)
        }
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    override var description: String{
        
        let  keys = ["text"]
        
        return dictionaryWithValuesForKeys(keys).description
    }


}
